package org.groupg.practice;

import cn.hutool.core.lang.Console;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Objects;

//TIP 要<b>运行</b>代码，请按 <shortcut actionId="Run"/> 或
// 点击装订区域中的 <icon src="AllIcons.Actions.Execute"/> 图标。
public class Main {
    private static final Logger log = LoggerFactory.getLogger(Main.class);

    public static void main(String[] args) throws URISyntaxException, IOException {


        String html = Files.readString(Path.of(Objects.requireNonNull(Main.class.getResource("/html.txt")).toURI()));
        Document doc = Jsoup.parse(html);
        doc.select("#js_content > h3 > strong > span > span").stream().forEach(e -> {
            log.info(e.text().trim());
        });
        doc.select("#js_content > section > span > span").stream().forEach(e -> {
            Console.log(e.text().trim());
        });

    }
}